{% extends 'base.html' %}

{% block title %}知疑 - 用户注册{% endblock %}

{% block content %}
<div class="row justify-content-center">
    <div class="col-md-6 col-lg-5">
        <div class="card form-card">
            <div class="card-header text-center bg-primary text-white">
                <h4 class="mb-0">用户注册</h4>
            </div>
            <div class="card-body">
                <form method="post">
                    {{ form.hidden_tag() }}
                    
                    <div class="mb-3">
                        {{ form.email.label(class="form-label") }}
                        {% if form.email.errors %}
                            {{ form.email(class="form-control is-invalid") }}
                            <div class="invalid-feedback">
                                {% for error in form.email.errors %}
                                    {{ error }}
                                {% endfor %}
                            </div>
                        {% else %}
                            {{ form.email(class="form-control") }}
                            <div class="form-text">请使用有效的电子邮箱地址</div>
                        {% endif %}
                    </div>
                    
                    <div class="mb-3">
                        {{ form.username.label(class="form-label") }}
                        {% if form.username.errors %}
                            {{ form.username(class="form-control is-invalid") }}
                            <div class="invalid-feedback">
                                {% for error in form.username.errors %}
                                    {{ error }}
                                {% endfor %}
                            </div>
                        {% else %}
                            {{ form.username(class="form-control") }}
                            <div class="form-text">用户名必须以字母开头，只能包含字母、数字、下划线和点号</div>
                        {% endif %}
                    </div>
                    
                    <div class="mb-3">
                        {{ form.password.label(class="form-label") }}
                        {% if form.password.errors %}
                            {{ form.password(class="form-control is-invalid") }}
                            <div class="invalid-feedback">
                                {% for error in form.password.errors %}
                                    {{ error }}
                                {% endfor %}
                            </div>
                        {% else %}
                            {{ form.password(class="form-control") }}
                            <div class="form-text">密码长度至少为8个字符</div>
                        {% endif %}
                    </div>
                    
                    <div class="mb-3">
                        {{ form.password2.label(class="form-label") }}
                        {% if form.password2.errors %}
                            {{ form.password2(class="form-control is-invalid") }}
                            <div class="invalid-feedback">
                                {% for error in form.password2.errors %}
                                    {{ error }}
                                {% endfor %}
                            </div>
                        {% else %}
                            {{ form.password2(class="form-control") }}
                        {% endif %}
                    </div>
                    
                    <div class="d-grid">
                        {{ form.submit(class="btn btn-primary") }}
                    </div>
                </form>
            </div>
            <div class="card-footer text-center">
                <p class="mb-0">已有账号？<a href="{{ url_for('auth.login') }}">立即登录</a></p>
            </div>
        </div>
    </div>
</div>
{% endblock %} 